﻿using PLCS.Application.Contracts.ProcessApp.Dtos;
using PLCS.Application.Contracts.SolutionApp.Dtos;
using PLCS.Client.IService.ProcessSolution;
using PLCS.Domain.Solutions;

using Volo.Abp.Application.Dtos;

namespace PLCS.Client.Service.ProcessSolution;

public class SolutionService : BaseService<SolutionDto, SolutionEditDto>, ISolutionService
{
    public async Task<PagedResultDto<SolutionDto>> GetListBySearchAsync(int skipCount, int maxResultCount, string? solutionNo)
    {
        var route = $"solution/bySearch?SkipCount={skipCount}&MaxResultCount={maxResultCount}";
        if (!string.IsNullOrEmpty(solutionNo))
            route += $"&solutionNo={solutionNo}";
        RequestParam requestParam = new(method: Method.Get, route: route);
        var apiRes = await restClient.ExecuteAsync<PagedResultDto<SolutionDto>>(requestParam);
        if (apiRes.Status)
            return apiRes.Data;
        else
            return new PagedResultDto<SolutionDto>();
    }
}